﻿using System.Collections.Generic;
using Domain.Models;

namespace Domain.NHibernate.Models
{
    public class GetAllDoersQuery
    {
        private readonly ISessionAdapter sessionAdapter;

        public GetAllDoersQuery(ISessionAdapter sessionAdapter)
        {
            this.sessionAdapter = sessionAdapter;
        }

        public IList<Doer> Execute()
        {
            return sessionAdapter.Session.CreateCriteria<Doer>()
                .List<Doer>();

        }
    }
}